<!doctype html>
<html>
  <head>
    <!-- Global site tag (gtag.js) - Google Analytics -->
    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-132775238-1"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
      gtag('config', 'UA-132775238-1');
    </script>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
    <script type="module" src="../rapidoc-min.js"></script>
  </head>
  <body>
    <rapi-doc id="thedoc"
      spec-url = "../specs/mock.yaml" 
      allow-authentication = "false"
      show-header="false"
      render-style = "read"
      sort-tags = "true"
      primary-color="#f54c47"
    > 

    </rapi-doc>

    <script>
      document.addEventListener('DOMContentLoaded', (event) => {
        let docEl = document.getElementById("thedoc");

        docEl.addEventListener('before-render', (e) => {
          e.detail.spec.info.description = "This description is updated using java-script on `before-render` event";
        });

        docEl.addEventListener('after-try', (e) => {
          console.log('Try Complete:', e.detail);
        });
        /*
        docEl.addEventListener('before-try', (e) => {
          // e.detail.controller.abort('Reason to abort');
          setTimeout(() => {
            e.detail.controller.abort('Reason to abort');
          }, 100);
        });

        docEl.addEventListener('Request Aborted:', (e) => {
          console.log('Request Aborted', e);
        });
        */

      })
    </script>

  </body>
</html>